<section class="vbox">
    <?php echo $this->element('student/breadcrumbs'); ?>
    <section class="scrollable">
        <section class="hbox stretch">
            <?php echo $this->element('student/mini_profile'); ?>
            <aside class="bg-white">
                <section class="vbox">
                    <section class="panel panel-default">
                        <header class="panel-heading h4">
                            Transaction History
                        </header>
                        <div class="row wrapper">
                            <div class="col-sm-5 m-b-xs">
                               <!-- <select class="input-sm form-control input-s-sm inline v-middle">
                                    <option value="0">Bulk action</option>
                                    <option value="1">Delete selected</option>
                                    <option value="2">Bulk edit</option>
                                    <option value="3">Export</option>
                                </select>-->
                                <button type="button" id="print_tran_history_btn" class="btn  btn-info">
                                    <i class="fa fa-print"></i> Print All Transactions
                                </button>
                            </div>
                           <!-- <div class="col-sm-4 m-b-xs">
                                <div class="btn-group" data-toggle="buttons">
                                    <label class="btn btn-sm btn-default active">
                                        <input type="radio" name="options" id="option1"> Day
                                    </label>
                                    <label class="btn btn-sm btn-default">
                                        <input type="radio" name="options" id="option2"> Week
                                    </label>
                                    <label class="btn btn-sm btn-default">
                                        <input type="radio" name="options" id="option2"> Month
                                    </label>
                                </div>
                            </div>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="text" class="input-sm form-control" placeholder="Search">
                                  <span class="input-group-btn">
                                    <button class="btn btn-sm btn-default" type="button">Go!</button>
                                  </span>
                                </div>
                            </div>-->
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped b-t b-light table-bordered">
                                <thead>
                                    <tr>
                                        <!--<th width="20"><input type="checkbox"></th>-->
                                        <th colspan="2">Transaction Type</th>
                                        <th>Amount (GHC)</th>
                                        <th>Date</th>
                                        <th>Reference</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <?php
                                if(!empty($transactData)){
                                    $count = $this->Paginator->counter("%start%");
                                    foreach( $transactData as $val ) {
                                        $semester = '';
                                        $acc_year = '';
                                        if(isset($val['Fee']['FeeType'])){
                                            $reference = $val['Fee']['FeeType']['description'];
                                        }
                                        else{
                                            $reference = '';
                                        }

                                        if(isset($val['Transaction']['AcademicSession']['semester'])){
                                            $semester = 'Semester '.$val['Transaction']['AcademicSession']['semester'];
                                        }
                                        if(isset($val['Transaction']['AcademicSession']['acc_year'])){
                                            $acc_year = $val['Transaction']['AcademicSession']['acc_year'].' Academic Year';
                                        }
                                        ?>
                                        <tr>
                                            <td><?php echo $count++.'.'; ?></td>
                                            <td><?php echo $val['TransactionItem']['desc']; ?></td>
                                            <td class="col_amt"><?php echo $controller->formatNumber($val['TransactionItem']['credit_amt'],'money'); ?></td>
                                            <td><?php echo date("d M Y, g:ia", strtotime($val['Transaction']['created'])); ?></td>
                                            <td><?php echo $reference; ?></td>
                                        </tr>
                                    <?php
                                    }
                                }
                                else{
                                    ?>
                                    <tr>
                                        <td colspan="6">
                                            <div class="text-center h4">
                                                No transaction histories.
                                            </div>
                                        </td>
                                    </tr>
                                <?php
                                }
                                ?>
                                </tbody>
                            </table>
                        </div>
                        <footer class="panel-footer">
                            <div class="row">
                                <div class="col-sm-12 text-right text-center-xs">
                                    <ul class="pagination pagination-sm m-t-none m-b-none">
                                        <?php
                                        echo $this->Paginator->first("<i class='fa fa-chevron-left'></i>", array('tag' => 'li','escape' => false), null);
                                        echo $this->Paginator->numbers(array('currentClass'=>'active','currentTag'=>'a','separator' => '', 'tag' => 'li'));
                                        echo $this->Paginator->last("<i class='fa fa-chevron-right'></i>", array('tag' => 'li','escape' => false), null);
                                        ?>
                                       <!-- <li><a href="#"><i class="fa fa-chevron-left"></i></a></li>
                                        <li><a href="#">1</a></li>
                                        <li><a href="#">2</a></li>
                                        <li><a href="#">3</a></li>
                                        <li><a href="#">4</a></li>
                                        <li><a href="#">5</a></li>
                                        <li><a href="#"><i class="fa fa-chevron-right"></i></a></li>-->
                                    </ul>
                                </div>
                            </div>
                        </footer>
                        <input type="hidden" id="print_history" value="<?php echo $this->Html->url(array('controller' => 'Student', 'action' => 'print_history')); ?>" />
                    </section>
                </section>
            </aside>
            <!--<aside class="col-lg-4 b-l">

            </aside>-->
        </section>
    </section>
</section>
<a href="#" class="hide nav-off-screen-block" data-toggle="class:nav-off-screen, open" data-target="#nav,html"></a>
<?php
    echo $this->Html->script('student/history.js',array('inline'=>false));
?>